home *** CD-ROM | disk | FTP | other *** search
/ E.M.Computergraphic Phase 4 / Phase 4 - Desktop Video Dreams (E. M. Computergraphic)(1996).iso / utilities / imagestudio / rexx / demo.isrx < prev    next >
Text File  |  1996-01-17  |  7KB  |  222 lines

  1. /* ImageStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. SQ = "'"
  15.  
  16. REQUEST_MESSAGE TEXT '"Welcome to ImageStudio!\n\n'||,
  17.     'This script will show some of features\n'||,
  18.     'of the program; if you wish to stop the\n'||,
  19.     'script at any time, just press Cancel."',
  20.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  21.  
  22. REQUEST_MESSAGE TEXT '"ImageStudio'SQ's ARexx interface has\n'||,
  23.     'been designed to be easy to use and\n'||,
  24.     'includes many built in facilities to\n'||,
  25.     'simplify the writing of scripts. One\n'||,
  26.     'example of this is the number of\n'||,
  27.     'different requester types available.\n'||,
  28.     'This requester is a REQUEST_MESSAGE\n'||,
  29.     'requester, the following is a\n'||,
  30.     'REQUEST_FILE requester..."',
  31.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  32.  
  33. REQUEST_FILE
  34.  
  35. REQUEST_MESSAGE TEXT '"You chose:\n\n'||RESULT||'\n\n'||,
  36.     'Batch processing requires the choosing\n'||,
  37.     'of multilple files, for this we use the\n'||,
  38.     'REQUEST_MULTIFILE requester..."',
  39.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  40.  
  41. REQUEST_MULTIFILE STEM multifileinfo.
  42.  
  43. REQUEST_MESSAGE TEXT '"You chose '||multifileinfo.files.count||' files.\n\n'||,
  44.     'Directories can be chosen with the\n'||,
  45.     'REQUEST_DIR requester..."',
  46.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  47.  
  48. REQUEST_DIR
  49.  
  50. REQUEST_MESSAGE TEXT '"You chose:\n\n'||RESULT||'\n\n'||,
  51.     'ImageStudio also has a built in screen\n'||,
  52.     'mode requester for choosing modes, sizes,\n'||,
  53.     'depths and overscan details of screens.\n'||,
  54.     'Here is the REQUEST_SCREENMODE requester..."',
  55.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  56.  
  57. REQUEST_SCREENMODE GADSENABLED STEM screenmodeinfo.
  58.  
  59. REQUEST_MESSAGE TEXT '"You chose:\n\n'||screenmodeinfo.text||'\n\n'||,
  60.     'In order to obtain differing types\n'||,
  61.     'of information from the user, further\n'||,
  62.     'requesters are given. Here is the simple\n'||,
  63.     'REQUEST_STRING requester..."',
  64.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  65.  
  66. REQUEST_STRING TEXT2 '"Enter your name:"' VAR username
  67.  
  68. REQUEST_MESSAGE TEXT '"Hello '||username||'\n\n'||,
  69.     'The REQUEST_MESSAGE requester is very\n'||,
  70.     'flexible and can be used for simple\n'||,
  71.     'multiple choice selections..."',
  72.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  73.  
  74. REQUEST_MESSAGE TEXT '"Are you male or female '||username||'?"',
  75.     BUTTONTEXT "Male|Female|Cancel" AUTOCANCEL VAR usersex
  76.  
  77. if usersex == 1 then
  78.     usersexdesc = 'bloke.'
  79. else
  80.     usersexdesc = 'girl.'
  81.  
  82. REQUEST_MESSAGE TEXT '"'||username||' is a good name for a '||,
  83.     usersexdesc||'\n\n'||,
  84.     'More complex multiple choices are made\n'||,
  85.     'with the REQUEST_LIST requester. For\n'||,
  86.     'example, select your computer..."',
  87.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  88.  
  89. REQUEST_LIST TITLE '"Choose your computer..."' STRINGS,
  90.     '"Amiga 500"' '"Amiga 600"' '"Amiga 1000"' '"Amiga 1200"',
  91.     '"Amiga 1500"' '"Amiga 2000"' '"Amiga 3000"' '"Amiga 4000"',
  92.     '"CD32"' '"None of the above"'
  93.  
  94. REQUEST_MESSAGE TEXT '"Good to hear it.\n\n'||,
  95.     'To change multiple values at one time\n'||,
  96.     'the REQUEST_MULTIVALUE requester is\n'||,
  97.     'used. This works in a similar manner\n'||,
  98.     'to the Prefs requester, enter details\n'||,
  99.     'about your computer..."',
  100.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  101.  
  102. REQUEST_MULTIVALUE TITLE '"Enter computer details..."' STRINGS,
  103.     '"Processor"' 68030,
  104.     '"Memory"' '"10MBytes"',
  105.     '"Hard drive"' '"550MBytes"',
  106.     '"Monitor"' '"14in multiscan"',
  107.     '"Printer"' '"Epson 9-pin"'
  108.  
  109. REQUEST_MESSAGE '"OK, OK, OK, enough requesters!\n\n'||,
  110.     'ImageStudio can do all of the operations\n'||,
  111.     'available from the GUI. For example,\n'||,
  112.     'select an image..."',
  113.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  114.  
  115. REQUEST_FILE VAR filename
  116.  
  117. OPEN '"'filename'"'
  118.  
  119. BALANCE BRIGHTNESS 50
  120.  
  121. REQUEST_MESSAGE '"The image is a bit brighter now, right?"',
  122.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  123.  
  124. EFFECT NAME '"FlipY"'
  125.  
  126. REQUEST_MESSAGE TEXT '"Effects, colour balance and\n'||,
  127.     'convolution filters can all be applied\n'||,
  128.     'through ARexx. As can scaling, colour\n'||,
  129.     'reduction, loading and saving - in fact\n'||,
  130.     'the only thing you can'SQ't do is alter\n'||,
  131.     'the GUI i.e. you can'SQ't move, open or\n'||,
  132.     'close windows from ARexx. Yet."',
  133.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  134.  
  135. REQUEST_MESSAGE TEXT '"ARexx also allows you access to\n'||,
  136.     'powerful features not available through\n'||,
  137.     'the GUI. One example of this is file\n'||,
  138.     'notification which will inform the\n'||,
  139.     'current script when a file is changed in\n'||,
  140.     'a current directory. For example, select\n'||,
  141.     'OK then copy any file into the Ram Disk..."',
  142.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  143.  
  144. NOTIFY_DIR PATHPART "ram:" STEM notifyinfo.
  145.  
  146. SCREEN_FRONT
  147.  
  148. REQUEST_MESSAGE TEXT '"You copied:\n\n'notifyinfo.filepart'\n\n'||,
  149.     'This could be useful if you wish\n'||,
  150.     'to start processing when a certain\n'||,
  151.     'file is created."',
  152.     BUTTONTEXT "OK|Cancel" AUTOCANCEL
  153.  
  154. REQUEST_MESSAGE TEXT '"Thanks for following this demo\n'||,
  155.     'and we hope you'SQ'll enjoy using the\n'||,
  156.     'new power available through ARexx.\n'||,
  157.     'Feel free to look at the source code\n'||,
  158.     'of this demo and of the example\n'||,
  159.     'scripts to learn further how ARexx\n'||,
  160.     'can be used to work for you."'
  161.  
  162. /* END PROGRAM ***************************************************/
  163.  
  164. exit
  165.  
  166. /* On ERROR */
  167.  
  168. ERROR:
  169.  
  170. /* If we get here, either an error occurred with the command's */
  171. /* execution or there was an error with the command itself. */
  172. /* In the former case, rc2 contains the error message and in */
  173. /* the latter, rc2 contains an error number. SIGL contains */
  174. /* the line number of the command which caused the jump */
  175. /* to ERROR: */
  176.  
  177. if datatype(rc2,'NUMERIC') == 1 then do
  178.     /* See if we can describe the error with a string */
  179.  
  180.     select
  181.         when rc2 == 103 then
  182.             err_string = "ERROR 103, "||,
  183.                 "out of memory at line "||SIGL
  184.         when rc2 == 114 then
  185.             err_string = "ERROR 114, "||,
  186.                 "bad command template at line "||SIGL
  187.         when rc2 == 115 then
  188.             err_string = "ERROR 115, "||,
  189.                 "bad number for /N argument at line "||SIGL
  190.         when rc2 == 116 then
  191.             err_string = "ERROR 116, "||,
  192.                 "required argument missing at line "||SIGL
  193.         when rc2 == 117 then
  194.             err_string = "ERROR 117, "||,
  195.                 "value after keywork missing at line "||SIGL
  196.         when rc2 == 118 then
  197.             err_string = "ERROR 118, "||,
  198.                 "wrong number of arguments at line "||SIGL
  199.         when rc2 == 119 then
  200.             err_string = "ERROR 119, "||,
  201.                 "unmatched quotes at line "||SIGL
  202.         when rc2 == 120 then
  203.             err_string = "ERROR 120, "||,
  204.                 "line too long at line "||SIGL
  205.         when rc2 == 236 then
  206.             err_string = "ERROR 236, "||,
  207.                 "unknown command at line "||SIGL
  208.         otherwise
  209.             err_string = "ERROR "||rc2||", at line "||SIGL
  210.         end
  211.         end
  212. else if rc2 == 'RC2' then do
  213.     err_string = "ERROR in command at line "||SIGL
  214.     end
  215. else do
  216.         err_string = rc2||", line "||SIGL
  217.         end
  218.  
  219. request_message TEXT '"'err_string'"'
  220.  
  221. exit
  222.